{% extends "base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% block head_title %}{% if qualification %}{% trans "Édition de la Qualif’" %}{% else %}{% trans "Nouvelle Qualif’" %}{% endif %}{% endblock %}

{% block bootstrap3_extra_head %}
{{ form.media.css }}
{% endblock %}
{% block content %}
    <h1>{{ session }}</h1>
    <h2>{% if qualification %}{% trans "Édition de la Qualif’" %}{% else %}{% trans "Nouvelle Qualif’" %}{% endif %}</h2>

    {% if qualification_user_errors %}
    <div>
        {{ qualification_user_errors }}
    </div>
    {% endif %}

    <form method="POST" action="" class="form-horizontal">
        {% csrf_token %}
        {% bootstrap_form form layout='horizontal' %}

        {% if timesheets %}
            <div class="form-group">
                <div class="col-md-9 col-md-offset-3">
                    {% include "challenge/_qualification_warning_timesheets.html" %}
                </div>
            </div>
        {% endif %}

        {% buttons %}
            <button type="submit" class="btn btn-primary pull-right">{% trans "Enregistrer" %}</button>
            <a class="btn btn-default" href="{% url 'session-detail' seasonpk=season.pk pk=session.pk %}">{% trans "Annuler" %}</a>
        {% endbuttons %}
    </form>
{% endblock %}

{% block bootstrap3_extra_script %}
{{ form.media.js }}
<script type="text/javascript">
{% comment %}Permet la sélection des moniteurs 1 sans control-click{% endcomment %}
$('select#id_helpers option').mousedown(function(e) {
    e.preventDefault();
    $(this).prop('selected', $(this).prop('selected') ? false : true);
    return false;
});
</script>
{% endblock %}
